home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / var / lib / dpkg / info / dpkg.postinst < prev    next >
Text File  |  2008-09-03  |  2KB  |  96 lines

  1. #!/bin/sh -e
  2. # This script can be called in the following ways:
  3. #
  4. # After the package was installed:
  5. #    <postinst> configure <old-version>
  6. #
  7. #
  8. # If prerm fails during upgrade or fails on failed upgrade:
  9. #    <old-postinst> abort-upgrade <new-version>
  10. #
  11. # If prerm fails during removal:
  12. #    <old-postinst> abort-remove
  13. #
  14. # If prerm fails during deconfiguration of a package:
  15. #    <postinst> abort-deconfigure in-favour <new-package> <version>
  16. #           removing <old-package> <version>
  17. #
  18. # If prerm fails during replacement due to conflict:
  19. #    <postinst> abort-remove in-favour <new-package> <version>
  20.  
  21.  
  22. # Create the database files if they don't already exist
  23. create_database() {
  24.     admindir=/var/lib/dpkg
  25.  
  26.     for file in diversions statoverride status; do
  27.     if [ ! -f "$admindir/$file" ]; then
  28.         touch "$admindir/$file"
  29.     fi
  30.     done
  31. }
  32.  
  33.  
  34. # Move the info directory from /usr/info to /usr/share/info
  35. move_info_directory() {
  36.     if [ -d /usr/info ] && [ ! -L /usr/info ] \
  37.     && [ -f /usr/info/dir ] && [ ! -L /usr/info/dir ]
  38.     then
  39.     echo "Moving /usr/info/dir to /usr/share/info/dir ..."
  40.     mv /usr/info/dir /usr/share/info/dir
  41.     if [ -f /usr/info/dir.old ]; then
  42.         mv /usr/info/dir.old /usr/share/info/dir.old
  43.     fi
  44.     fi
  45. }
  46.  
  47.  
  48. # Remove the /usr/info symlinks we used to generate
  49. remove_info_symlink() {
  50.     if [ -L /usr/info ]; then
  51.     echo "Removing /usr/info symlink ..."
  52.     rm /usr/info
  53.     elif [ -L /usr/info/dir ]; then
  54.     echo "Removing /usr/info/dir symlink ..."
  55.     rm /usr/info/dir
  56.     fi
  57. }
  58.  
  59. # Create log file and set default permissions if possible
  60. create_logfile() {
  61.     logfile=/var/log/dpkg.log
  62.     touch $logfile
  63.     chmod 640 $logfile
  64.     chown root:adm $logfile 2>/dev/null || chown 0:4 $logfile
  65. }
  66.  
  67.  
  68. case "$1" in
  69.     configure)
  70.     create_database
  71.     create_logfile
  72.  
  73.     move_info_directory
  74.     remove_info_symlink
  75.  
  76.     if test -f /var/lib/dpkg/triggers/Unincorp; then
  77.         # Upgrade from broken trigger interest recorder
  78.         #  (bugs.launchpad.net/133172).  We remove this
  79.         #  old stale file:
  80.         rm -f /var/lib/dpkg/triggers/Deferred
  81.     fi
  82.  
  83.     ;;
  84.  
  85.     abort-upgrade|abort-deconfigure|abort-remove)
  86.     ;;
  87.  
  88.     *)
  89.     echo "$0 called with unknown argument \`$1'" 1>&2
  90.     exit 1
  91.     ;;
  92. esac
  93.  
  94.  
  95. exit 0
  96.